// 业务错误类
export class BusinessError extends Error {
  constructor(message, details = null, statusCode = 400) {
    super(message);
    this.name = 'BusinessError';
    this.statusCode = statusCode;
    this.details = details;
  }
}

// 认证错误类
export class AuthError extends Error {
  constructor(message = '认证失败', statusCode = 401) {
    super(message);
    this.name = 'AuthError';
    this.statusCode = statusCode;
  }
}

// 权限错误类
export class PermissionError extends Error {
  constructor(message = '权限不足', statusCode = 403) {
    super(message);
    this.name = 'PermissionError';
    this.statusCode = statusCode;
  }
}

// 资源不存在错误类
export class NotFoundError extends Error {
  constructor(message = '资源不存在', statusCode = 404) {
    super(message);
    this.name = 'NotFoundError';
    this.statusCode = statusCode;
  }
}

// 验证错误类
export class ValidationError extends Error {
  constructor(message, errors = [], statusCode = 422) {
    super(message);
    this.name = 'ValidationError';
    this.statusCode = statusCode;
    this.errors = errors;
  }
}
